﻿<Window x:Class="Asistente.AppWindows"
	  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:raiz="clr-namespace:Asistente"
	  xmlns:converters="clr-namespace:Asistente.Converters"
	  xmlns:sys="clr-namespace:System;assembly=mscorlib"
	  xmlns:representation="clr-namespace:Asistente.Model.Representation"  
	  xmlns:ifpug="clr-namespace:Asistente.Model.IFPUG"  
	  Title="Software Functional Size Measurment Wizard" WindowStartupLocation="CenterScreen" Height="605" Width="1002" AllowsTransparency="False" Background="#FFE8E2E2" Icon="/Asistente;component/Images/wizard.jpg">
		<Window.Resources>

		<ObjectDataProvider x:Key="viewModel" 
		  ObjectType="{x:Type raiz:ViewModel}">
		</ObjectDataProvider>

		<!--Convertes-->
		<BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
		<converters:IsEnabledNewUseCaseButton x:Key="ConvertidorBotonNewUseCase"/>
		<converters:EntitiesCollectionNameConverter x:Key="EntitiesCollectionNameConverter"/> 
		<converters:PanelMasterDetailsCollectionConverter x:Key="PanelMasterDetailsCollectionConverter"/>
		<converters:PanelMasterDetailsTemplateSelector x:Key="PanelMasterDetailsTemplateSelector"/>
		<converters:AddDataGroupToControlEnabledConverter x:Key="EnableAddDataGroupToControlButtonConverter"/>
		<converters:IsMantainedEntityConverter x:Key="ConvertidorIsMantained"/>
		<converters:GetTypeFromObjectConverter x:Key="GetTypeConverter"/>
		<converters:GetTypeFromUseCase x:Key="GetTypeUseCaseConverter"/>

		<!--Templates-->

		<!-- Use Case Layout Combo Box-->
		<DataTemplate x:Key="UseCaseComboBoxTemplate">            
				<TextBlock Text="{Binding Path=Name}" />
		</DataTemplate>

		<!-- Transactional function type Layout Combo Box-->
		<DataTemplate x:Key="TransactionalFunctionTypeTemplate">
			<TextBlock Text="{Binding Path=Name}" />
		</DataTemplate>
		
		<!-- Entity Layout-->
		<DataTemplate x:Key="entityLayout" DataType="Entity" >
			<TextBlock Text="{Binding Path=Name}">
				<TextBlock.ContextMenu>
				<ContextMenu Name="cm">
				   <MenuItem Header="Delete this Entity" Click="DeleteEntityClick"/>
				</ContextMenu>
			</TextBlock.ContextMenu>
			</TextBlock>
		</DataTemplate>

		<!-- Entity Layout RadioButton-->
		<DataTemplate x:Key="entityLayoutRadioButton" DataType="Entity">
			<RadioButton GroupName="Entities" Content="{Binding Path=Name}" IsChecked="{Binding Path=IsChecked}" /> 
		</DataTemplate>

		<!-- DataGroup Layout -->
		<DataTemplate x:Key="dataGroupLayout" DataType="DataGroup">
			<TextBlock Text="{Binding Path=Name}" />
		</DataTemplate>

		<!-- ActionTemplate-->
		<DataTemplate x:Key="ActionTemplate">
			
			<TextBlock Text="{Binding Path=Name}" />
		</DataTemplate>

		<!-- ControlTemplate-->
		<DataTemplate x:Key="ControlTemplate">
			<DockPanel Height="15">
				<Image Source="Images\control.png"/>
				<TextBlock Text="{Binding Path=LongName, UpdateSourceTrigger=PropertyChanged}"/>
			</DockPanel>
		</DataTemplate>
	   

		<!-- PanelTemplate-->
		<HierarchicalDataTemplate  x:Key="PanelTemplate" 
		ItemsSource="{Binding Path=Controls}"
		ItemTemplate="{StaticResource ControlTemplate}">
			<DockPanel Height="15">
				<Image Source="Images\panel.png"/>
				<TextBlock Text="{Binding Path=Name}" />
			</DockPanel>
		</HierarchicalDataTemplate>
		
		<!--MasterDetailsTemplate-->
		<HierarchicalDataTemplate  x:Key="MasterDetailsTemplate" >
			<HierarchicalDataTemplate.ItemsSource>
				<MultiBinding Converter="{StaticResource PanelMasterDetailsCollectionConverter}">
					<Binding Path="Master"></Binding>
					<Binding Path="Details"></Binding>
				</MultiBinding>
			</HierarchicalDataTemplate.ItemsSource>
			<DockPanel Height="15">
				<Image Source="Images\masterdetail.png"/>
			<TextBlock Text="{Binding Path=Name}" />
			</DockPanel>
		</HierarchicalDataTemplate>

		<!-- ScreenTemplate-->
		<HierarchicalDataTemplate x:Key="ScreenTemplate" ItemTemplateSelector="{StaticResource PanelMasterDetailsTemplateSelector}">
			<HierarchicalDataTemplate.ItemsSource>
				<MultiBinding Converter="{StaticResource PanelMasterDetailsCollectionConverter}">
					<Binding Path="Panels"></Binding>
					<Binding Path="MasterDetails"></Binding>
				</MultiBinding>
			</HierarchicalDataTemplate.ItemsSource>
			<DockPanel Height="15">
				<Image Source="Images\screen.png"/>
				<TextBlock Text="{Binding Path=Name}" />
			</DockPanel>
		</HierarchicalDataTemplate>
		
		<!-- UseCaseTemplate -->
		<HierarchicalDataTemplate  x:Key="UseCaseTemplate"
		    ItemsSource="{Binding Path=Screens}"
			ItemTemplate="{StaticResource ScreenTemplate}" >
			<DockPanel Name="SecondTreeViewItem" Height="15">
				<Image Source="Images\usecase.png"/>
				<TextBlock Text="{Binding Path=Name}" />
			</DockPanel>
		</HierarchicalDataTemplate>

		<!-- ApplicationTemplate -->
		<DataTemplate x:Key="ApplicationTemplate" DataType="Application">
			<TextBlock Text="{Binding Path=Name}" />
		</DataTemplate>

		<!-- Enum UseCaseLayoutCombinations -->
		<ObjectDataProvider MethodName="GetValues"
						ObjectType="{x:Type sys:Enum}"
						x:Key="UseCaseLayoutCombinationsEnum">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="representation:UseCaseLayoutCombinations"></x:Type>
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>

		<!-- Enum TransactionalFunctionType -->
		<ObjectDataProvider MethodName="GetValues"
						ObjectType="{x:Type sys:Enum}"
						x:Key="TransactionalFunctionTypeEnum">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="ifpug:TransactionalFunctionType"></x:Type>
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>

		<!-- Enum UseCasePatterns -->
		<ObjectDataProvider MethodName="GetValues"
						ObjectType="{x:Type sys:Enum}"
						x:Key="UseCasePatternsEnum">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="representation:UseCasePattern"></x:Type>
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>

		<!-- Enum ControlPattern -->
		<ObjectDataProvider MethodName="GetValues"
						ObjectType="{x:Type sys:Enum}"
						x:Key="ControlPatternEnum">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="representation:ControlPattern"></x:Type>
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>

	</Window.Resources>
	
	<Grid x:Name="LayoutRoot" Background="White">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="212" />
			<ColumnDefinition Width="758*" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="563*" MinHeight="300" />
		</Grid.RowDefinitions>
		<!--Data Source-->
		<Grid.DataContext>
			<Binding Source="{StaticResource viewModel}"/>
		</Grid.DataContext>
		
		<!--Tabs-->
		   <TabControl x:Name="Tab" Margin="6,8,8,8" Grid.Column="1">			
			   <TabControl.ItemContainerStyle>
				<Style TargetType="{x:Type TabItem}">
					<Setter Property="Visibility"
					Value="{Binding TabHeaderVisible, Converter={StaticResource booleanToVisibilityConverter}}" />
				</Style>
			</TabControl.ItemContainerStyle>
			   
			   
			<!--Application Tab-->
			<TabItem Header="Application" Name="Application" >
				<Grid Background="#FFE5E5E5" VerticalAlignment="Stretch">
					<Grid.RowDefinitions>
						<RowDefinition Height="150" MinHeight="150" />
						<RowDefinition Height="286*" />
						<RowDefinition Height="36" />
						<RowDefinition Height="46" MinHeight="46"/>
					</Grid.RowDefinitions>
					<Grid>
						<!--Name-->
						<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="29.513" />
						<TextBox Name="AppNameBox"  Height="25" Margin="98,7,16,0"  TextWrapping="Wrap" Text="{Binding Path=App.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="Auto" VerticalContentAlignment="Stretch" >
						</TextBox>
							<!--Description-->
						<TextBlock HorizontalAlignment="Left" Margin="6,39,0,0"  Text="Description:" VerticalAlignment="Top" Height="29.513" />
						<TextBox Margin="98,36,16,24"  TextWrapping="Wrap" Text="{Binding Path=App.Description}" Width="Auto" FontSize="10" AcceptsReturn="True" AcceptsTab="True" />
					</Grid>
					<!--Use case-->
					<Button  Content="New Use Case" Margin="8,0,0,0" Click="NewUseCaseClick" Grid.Row="2" HorizontalAlignment="Left" Width="182" Height="21" VerticalAlignment="Top">
						<Button.IsEnabled >
							<MultiBinding Converter="{StaticResource ConvertidorBotonNewUseCase}" UpdateSourceTrigger="PropertyChanged"  >
								<Binding Path="SelectedUseCasePattern"/>
								<Binding Path="UseCasePattern"/>
								<Binding Path="SelectedUseCaseLayout"/>
							</MultiBinding>
						</Button.IsEnabled>

					</Button>
					<!--Use case Layout Combinations-->
					<ListBox Grid.Row="1" Name="UseCaseLayoutCombinationBoxApp" Margin="197,26,16,6" ItemsSource="{Binding Source={StaticResource UseCaseLayoutCombinationsEnum}}" SelectionChanged="UseCaseLayoutCombinationBoxAppSelectionChanged" FontSize="15">
					</ListBox>

						<!--Use case Patterns-->
					<ListBox Grid.Row="1" Name="UseCasePatternBoxApp" Margin="8,26,0,6" ItemsSource="{Binding Source={StaticResource UseCasePatternsEnum}}" HorizontalAlignment="Left" Width="182" SelectionChanged="UseCasePatternBoxAppSelectionChanged" FontSize="15" />
					<!--Buttons-->
					<Button  Grid.Row="3" Content="Delete This App" Margin="197,0,0,13" Click="DeleteApplicationClick" HorizontalAlignment="Left" Width="182" Height="24" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Center" VerticalAlignment="Bottom" />
					<Button  Grid.Row="3" Content="New Entity" Margin="8,0,0,14" Click="NewEntityClick" Width="182" HorizontalAlignment="Left" Height="23" VerticalAlignment="Bottom" />
					<TextBlock Height="17" HorizontalAlignment="Left" Margin="8,6,0,0" Text="Pattern:" VerticalAlignment="Top" Width="54" Grid.Row="1" />
					<TextBlock Height="17" HorizontalAlignment="Left" Margin="197,6,0,0" Text="Layout Combination:" VerticalAlignment="Top" Width="112" Grid.Row="1" />
					<!--Question Button-->
					<Button Height="30" AutomationProperties.HelpText="Help Text" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabApplicationButtonClick" Margin="0,0,11,10" Grid.Row="3" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
				</Grid>    
			</TabItem>

			<!--Use Case Tab-->
			<TabItem Name="UseCase" Header="Use Case" >
				<Grid Background="#FFE5E5E5" VerticalAlignment="Stretch" Width="Auto">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="738*" />
						<ColumnDefinition Width="6*" />
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition Height="138" />
						<RowDefinition Height="305*" MinHeight="281"/>
						<RowDefinition Height="75"/>
					</Grid.RowDefinitions>
					
					<Grid Grid.ColumnSpan="2">
						<!--Name-->
						<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="25" />
						<TextBox Height="25" Margin="98,7,8,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedUseCase.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="Auto" />
						<!--Description-->
						<TextBlock HorizontalAlignment="Left" Margin="6,39,0,0"  Text="Description:" VerticalAlignment="Top" Height="22" />
						<TextBox Margin="98,36,8,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedUseCase.Description}" Width="Auto" Height="56" VerticalAlignment="Top" AcceptsReturn="True" AcceptsTab="True" FontSize="10" />
						<!--Auditable-->
						<CheckBox IsChecked="{Binding Path=SelectedUseCase.Auditable}"  Content="Auditable" HorizontalAlignment="Left" Margin="427,112,0,0" Name="isAuditableUseCase" Height="16" VerticalAlignment="Top" />
						<CheckBox Content="Displays message" IsChecked="{Binding Path=SelectedUseCase.DisplayMessage}"  Margin="501,112,0,0" HorizontalAlignment="Left" Width="120" Height="26" VerticalAlignment="Top" />
					
						<!--Type-->
						<TextBlock Margin="98,100,0,0"  Text="{Binding Converter={StaticResource GetTypeUseCaseConverter},  Path=SelectedUseCase}" VerticalAlignment="Top" Height="31" HorizontalAlignment="Left" Width="309" Background="#64B7B7B7" />
						<TextBlock Height="25" HorizontalAlignment="Left" Margin="8,107,0,0" Text="Type:" VerticalAlignment="Top" />
					</Grid>
					
					<!--Use case-->
					<!--Use case Layout Combinations-->
					<!--Use case Patterns-->
					<ListBox Grid.Row="1" Name="UseCasePatternBoxUC" Margin="8,23,0,6"  ItemsSource="{Binding Source={StaticResource UseCasePatternsEnum}}" Width="154" HorizontalAlignment="Left" SelectionChanged="UseCasePatternBoxUcSelectionChanged" FontSize="15" SelectedItem="{Binding Path=SelectedUseCase.Pattern}" />
					<!--Buttons-->
					<TextBlock Margin="8,3,0,0"  Text="Pattern:"  Width="82" HorizontalAlignment="Left" Height="29" VerticalAlignment="Top" Grid.Row="1" />
					<Button  Content="New Screen" Margin="8,0,0,13" VerticalAlignment="Bottom" Click="NewScreenClick" Grid.Row="4" Height="23" HorizontalAlignment="Left" Width="154" />
					<Button  Content="Delete This Use Case" Margin="180,0,0,13" VerticalAlignment="Bottom" Click="DeleteUseCaseClick" Grid.Row="4" Height="23" HorizontalAlignment="Left" Width="163" />
					<Button  Content="Change Patern"  Margin="8,0,0,48" Width="154" Grid.Row="2" HorizontalAlignment="Left" Height="23" VerticalAlignment="Bottom" Click="ChangePatternClick"/>
						<!-- Cosmic IFpug data-->
					 <Grid Grid.Row="1" Margin="180,23,9,6" Name="grid2" Background="#64B7B7B7">
					   <Grid.ColumnDefinitions>
							<ColumnDefinition Width="169*" />
							<ColumnDefinition Width="3*" />
							<ColumnDefinition Width="173*" />
						</Grid.ColumnDefinitions>

						<!--IFPUG COLUMN -->
						
						<!-- Type -->
						<TextBlock Height="17" HorizontalAlignment="Left" Margin="23,59,0,0" Text="Type:" VerticalAlignment="Top" Width="32" />
						<ComboBox  IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresIfpug}" ItemsSource="{Binding Source={StaticResource TransactionalFunctionTypeEnum }}" Height="23" Margin="91,54,0,0"  VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding Path=SelectedUseCase.Type}" HorizontalAlignment="Left" Width="76" />

						<!-- Dets-->
						<Label Content="Dets" Height="28" HorizontalAlignment="Left" Margin="23,84,0,0" Name="detsLabel" VerticalAlignment="Top" />
						<TextBox Text="{Binding Path=SelectedUseCase.Dets}" Height="23" HorizontalAlignment="Left" Margin="90,84,0,0" Name="detsTextBox" VerticalAlignment="Top" Width="76" IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresIfpug}"/>
						<!-- Ftrs -->
						<Label Content="Ftrs" Height="28" HorizontalAlignment="Left" Margin="23,111,0,0" Name="ftrsLabel" VerticalAlignment="Top" />
						 <TextBox Text="{Binding Path=SelectedUseCase.Ftrs}" Height="23" Margin="89,117,0,0" Name="ftrsTextBox" VerticalAlignment="Top" Width="76" IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresIfpug}" HorizontalAlignment="Left" />
						<CheckBox Content="Overwrite" Margin="92,150,0,0" IsChecked="{Binding Path=SelectedUseCase.OverwrittenMeasuresIfpug}" Height="18" VerticalAlignment="Top" HorizontalAlignment="Left" Width="64" />
						
						 <!--COSMIC COLUMN-->
						<Label Content="Entries" Grid.Column="2" Height="28" HorizontalAlignment="Left" Margin="6,54,0,0"  VerticalAlignment="Top" />
						<Label Content="Exits" Grid.Column="2" Height="28" HorizontalAlignment="Left" Margin="18,84,0,0" VerticalAlignment="Top" />
						<Label Content="Reads" Grid.Column="2" HorizontalAlignment="Left" Margin="10,113,0,0" Height="27" VerticalAlignment="Top" />
						<Label Content="Writes" Height="28" HorizontalAlignment="Left" Margin="9,143,0,0" Name="label4" VerticalAlignment="Top" Grid.Column="2" />
						<TextBox IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresCosmic}" Text="{Binding Path=SelectedUseCase.Entries}" Grid.Column="2" Height="23" HorizontalAlignment="Left" Margin="59,54,0,0" Width="77" VerticalAlignment="Top" />
						<TextBox IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresCosmic}" Text="{Binding Path=SelectedUseCase.Exits}" Grid.Column="2" Height="23" Margin="57,145,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="79" />
						<TextBox IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresCosmic}" Text="{Binding Path=SelectedUseCase.Reads}" Grid.Column="2" Height="23" HorizontalAlignment="Left" Margin="58,115,0,0" Width="78" VerticalAlignment="Top" />
						<TextBox IsEnabled="{Binding Path=SelectedUseCase.OverwrittenMeasuresCosmic}" Text="{Binding Path=SelectedUseCase.Writes}" Grid.Column="2" Height="23" Margin="58,84,0,0"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="78" />
						<CheckBox IsChecked="{Binding Path=SelectedUseCase.OverwrittenMeasuresCosmic}" Content="Overwrite" Margin="57,176,0,0" Name="checkBoxOverriteCosmic" Grid.Column="2" Height="22" VerticalAlignment="Top" HorizontalAlignment="Left" Width="70" />
						
					</Grid>
					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabUseCaseButtonClick" Margin="0,0,5,10" Grid.Row="4" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Copy Use Case" Height="23" HorizontalAlignment="Left" Margin="182,0,0,45" Click="CloneUseCaseClick" VerticalAlignment="Bottom" Width="161" Grid.Row="2" />
				</Grid>
			</TabItem>

			<!--Screen Tab-->
			<TabItem Name="Screen" Header="Screen" FontSize="10">
				<Grid Background="#FFE5E5E5" VerticalAlignment="Stretch">					
					<Grid.RowDefinitions>
						<RowDefinition Height="107" MinHeight="80" />
						<RowDefinition Height="305*" />
						<RowDefinition Height="29" />
						<RowDefinition Height="31" />
						<RowDefinition Height="46" MinHeight="46"/>
					</Grid.RowDefinitions>
					
						<!--Name-->
						<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="29.513" />
						<TextBox Height="25" Margin="98,7,24,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedScreen.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" />
						<!--Description-->
						 <TextBlock HorizontalAlignment="Left" Margin="6,39,0,0"  Text="Description:" VerticalAlignment="Top" Height="29.513" />
						<TextBox Margin="98,36,24,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedScreen.Description}" Height="56" VerticalAlignment="Top" AcceptsTab="True" AcceptsReturn="True" />

					<Button Grid.Row="2" Content="New Panel" VerticalAlignment="Top" Click="NewPanelClick" Height="22" HorizontalAlignment="Left" Width="155" Margin="8,1,0,0">
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=TypeOfPanel, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>						
					
					<ListBox Name="TypeOfPanel"  Margin="8,19,0,5" Grid.Row="1" Width="155" HorizontalAlignment="Left" SelectionChanged="TypeOfPanelSelectionChanged" FontSize="15">
					   <ListBoxItem Content="Grid" />
						<ListBoxItem Content="Form"/>
						<ListBoxItem Content="Filter" FontSize="15" />
						<ListBoxItem Content="Graph"/>
						<ListBoxItem Content="Report"/>
					</ListBox>
					
					<!--Action-->
					<Button  Content="New Call Action" VerticalAlignment="Top" Click="NewUseCaseActionClick" Height="22" HorizontalAlignment="Left" Width="153" Margin="171,1,0,0" Grid.Row="2">
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=ComboBoxUseCase, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
						<ComboBox ItemTemplate="{StaticResource UseCaseComboBoxTemplate}" ItemsSource="{Binding Path=App.UseCases}" Name="ComboBoxUseCase" Height="22" Margin="330,1,24,0" VerticalAlignment="Top" Grid.Row="2" />
				   <!--Button-->
					<Button  Content="Delete This Screen" Click="DeleteScreenClick" Grid.Row="4" Margin="8,0,0,10" Width="155" HorizontalAlignment="Left" Height="23" VerticalAlignment="Bottom" />
					<DataGrid  Grid.Row="1" Margin="169,19,24,5" Name="actionsGrid" ItemsSource="{Binding Path=SelectedScreen.Actions}" AutoGenerateColumns="True" CanUserAddRows="False" CanUserDeleteRows="False" DataContext="{Binding}">

					</DataGrid>
					<Button Content="NewAction" Click="NewActionClick" Height="22" HorizontalAlignment="Left" Margin="171,0,0,0" VerticalAlignment="Top" Width="153" Grid.Row="3" />
			
					<!--MasterDetail-->
					<Button Grid.Row="3"  Click="NewMasterDetailClick" Content="New MasterDetail" Height="22" Margin="8,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="155" />
					<TextBlock Height="18" HorizontalAlignment="Left" Margin="6,0,0,0" Text="Panels and Master details:" VerticalAlignment="Top" Grid.Row="1" Width="155" />
					<TextBlock Height="18" HorizontalAlignment="Left" Margin="171,0,0,0" Text="Actions:" VerticalAlignment="Top" Width="155" Grid.Row="1" />
					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabScreenButtonClick"  Margin="0,0,11,10" Grid.Row="4" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Delete Action" Click="DeleteAction_Click" Height="22" HorizontalAlignment="Left" Margin="330,0,0,0" VerticalAlignment="Top" Width="153" Grid.Row="3" >
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=actionsGrid, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
				</Grid>
			</TabItem>           
			<!--Editable Panel Tab-->
			<TabItem Name="EditablePanel" Header="Editable Panel" >
				<Grid Background="#FFE5E5E5">
					<Grid.RowDefinitions>
						<RowDefinition Height="147"/>
						<RowDefinition Height="294*" />
						<RowDefinition Height="32" />
						<RowDefinition Height="46*" />
					</Grid.RowDefinitions>
					<TextBlock Margin="98,36,0,0"  Text="{Binding Converter={StaticResource GetTypeConverter},  Path=SelectedEditablePanel}" VerticalAlignment="Top" Height="35" HorizontalAlignment="Left" Width="243" Background="#64B7B7B7" OpacityMask="{x:Null}" Foreground="Black" />
					<TextBlock Margin="8,11,0,0"  Text="Name:" VerticalAlignment="Top" Height="26" HorizontalAlignment="Left" Width="57" />
					<TextBox Height="25" Margin="98,7,17,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedEditablePanel.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"/>
					<TextBlock HorizontalAlignment="Left" Margin="9,78,0,0"  Text="Edited Entity:" Width="70.893" TextWrapping="WrapWithOverflow" Height="21" VerticalAlignment="Top"/>
					   
					<!--Referenced entities-->
					<TextBlock HorizontalAlignment="Left" Margin="367,51,0,0"  Text="Referenced entities:" Width="103" TextWrapping="WrapWithOverflow" Height="15" VerticalAlignment="Top"/>
					<Label  Height="29" Content="{Binding Path=SelectedEditablePanel.UpdatesDeletesCascade, Converter={StaticResource EntitiesCollectionNameConverter}}" Margin="367,77,17,0" Name="referencedEntitiesLabel" Background="#64B7B7B7" HorizontalContentAlignment="Stretch" VerticalAlignment="Top" />
					<!--, Converter={StaticResource EntitiesCollectionName} ,-->
					<Button  Content="Add Reference" Click="ReferenceEntityClick" Margin="367,114,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="155" />

					<!--Buttons-->
					<Button  Content="Associate Entities to control" Name="AssociateEntitiesToControlButton" Click="AsociateEntitiesClick" Margin="331,1,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="155" Grid.Row="2" Height="23" IsEnabled="{Binding Converter={StaticResource EnableAddDataGroupToControlButtonConverter}, Path=SelectedControl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
					<Button  Content="Add Control"  Click="NewControlEditablePanelClick" Height="23" HorizontalAlignment="Left" Margin="9,1,0,0" VerticalAlignment="Top" Width="155" Grid.Row="2" />
					<Button  Content="Define Entity" Margin="98,114,0,0" VerticalAlignment="Top" Click="DefineEntityClick" HorizontalAlignment="Left" Width="119" />
					<Button  Content="Clear Edited Entity" Margin="222,114,0,0" VerticalAlignment="Top"   Click="DeleteSelectedEntityClick" HorizontalAlignment="Left" Width="119" />

					<TextBlock HorizontalAlignment="Left"   Text="Controls:" Width="70.893" TextWrapping="WrapWithOverflow" Height="24" VerticalAlignment="Top" Margin="6,0,0,0" Grid.Row="1" />
					<Button  Content="Delete This Panel" Click="DeleteEditablePanelClick" Margin="9,0,0,13" Width="155" Height="23" Grid.Row="3" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
					<DataGrid SelectionChanged="ControlGridEditablePanelSelection" CanUserDeleteRows="False" CanUserAddRows="False"  Name="ControlsEditable" ItemsSource="{Binding Path=SelectedEditablePanel.Controls, UpdateSourceTrigger=PropertyChanged}" Margin="9,18,17,12"  Grid.Row="1" VerticalAlignment="Stretch" AutoGenerateColumns="True" ClipToBounds="True" HorizontalContentAlignment="Stretch" />
					

					<Label Content="{Binding Path=SelectedEditablePanel.Entity.Name}" Height="29" HorizontalAlignment="Left" Margin="98,77,0,0" Name="labelSelectedEntity" VerticalAlignment="Top" Width="243" Background="#64B7B7B7" />
					<TextBlock Height="20" HorizontalAlignment="Left" Margin="9,41,0,0" Text="Type:" VerticalAlignment="Top" Width="57" />
					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click ="QuestionTabEditablePanelButtonClick"  Margin="0,0,11,10" Grid.Row="3" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Delete Control" Height="23" HorizontalAlignment="Left" Margin="170,1,0,0" VerticalAlignment="Top" Width="155" Grid.Row="2" Click="DeleteEditablePanelControlButton_Click" >
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=ControlsEditable, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
				</Grid>
			</TabItem>
		  

			<!--ReadOnly Panel Tab-->
			<TabItem Name="ReadOnlyPanel" Header="Read Only Panel" >
				<Grid Background="#FFE5E5E5" >
					<Grid.RowDefinitions>
						<RowDefinition Height="147" />
						<RowDefinition Height="288*" />
						<RowDefinition Height="38" />
						<RowDefinition Height="40" MinHeight="46"/>
					</Grid.RowDefinitions>
					<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="29.513"/>
					<TextBox Height="25" Margin="98,7,11,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedReadOnlyPanel.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" />
					<Button  Content="Define data group" Margin="98,114,0,0" VerticalAlignment="Top" Click="DefineDataGroupClick" HorizontalAlignment="Left" Width="151" />
					<Label Content="{Binding Path=SelectedReadOnlyPanel.DataGroup.Name}" Height="30"  Margin="98,79,11,0" Name="dataGroupLabelReadOnlyPanel" VerticalAlignment="Top" Background="#64B7B7B7" />
					<TextBlock HorizontalAlignment="Left" Margin="8,79,0,0"  Text="Data Group:" Width="70.893" TextWrapping="WrapWithOverflow" Height="20" VerticalAlignment="Top"/>
					<TextBlock HorizontalAlignment="Left" Margin="8,0,0,0" Text="Controls:" Width="70.893" TextWrapping="WrapWithOverflow" Height="27" VerticalAlignment="Top" Grid.Row="1" />
					<Button  Content="Delete This Panel" Click="DeleteReadOnlyPanelClick" Margin="8,0,0,12"  Width="132" Grid.Row="3" HorizontalAlignment="Left" Height="22" VerticalAlignment="Bottom" />
					<Button  Content="Add Control"  Click="NewControlReadOnlyPanelClick" Height="23" HorizontalAlignment="Left" Margin="8,0,0,16"  VerticalAlignment="Bottom" Width="140" Grid.Row="1" Grid.RowSpan="2" />
					<DataGrid SelectionChanged="ControlGridReadOnlyPanelSelection" Name="ControlsReadOnly" ItemsSource="{Binding Path=SelectedReadOnlyPanel.Controls}" Margin="8,16,11,8" AutoGenerateColumns="True" Grid.Row="1" VerticalContentAlignment="Stretch" CanUserAddRows="False"/>
					<Button  Content="Associate Entities to Control" Click="AsociateEntitiesClick" Margin="302,0,0,15" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="155" Grid.Row="2" Height="22" IsEnabled="{Binding Converter={StaticResource EnableAddDataGroupToControlButtonConverter}, Path=SelectedControl}">
					</Button>

					<TextBlock Margin="98,39,11,0"  Text="{Binding Converter={StaticResource GetTypeConverter},  Path=SelectedReadOnlyPanel}" VerticalAlignment="Top" Height="32" Background="#64B7B7B7" />
					<TextBlock Margin="8,40,0,0"  Text="Type:" VerticalAlignment="Top" Height="17" HorizontalAlignment="Left" Width="57" />


					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabReadOnlyPanelButtonClick"  Margin="0,0,11,10" Grid.Row="3" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Delete Control" Height="23" HorizontalAlignment="Left" Margin="154,0,0,16" VerticalAlignment="Bottom" Width="140" Grid.Row="1" Click="DeleteReadOnlyPanelControl_Click" Grid.RowSpan="2">
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=ControlsReadOnly, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
				</Grid>
			</TabItem>			
			   
			<!--Graph Tab-->
			<TabItem Header="Graph" Name="Graph">
				<Grid Background="#FFE5E5E5" Width="Auto">
					<Grid.RowDefinitions>
						<RowDefinition Height="400*"/>
						<RowDefinition Height="46"/>
					</Grid.RowDefinitions>
					<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="29.513"/>
					<TextBox Height="25" Margin="98,7,8,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedGraph.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="Auto" />
						<Button  Content="Define data group" Margin="98,110,0,0" VerticalAlignment="Top" Click="DefineDataGroupClick" HorizontalAlignment="Left" Width="151" />
					<Label Content="{Binding Path=SelectedGraph.DataGroup.Name}" Height="25" Margin="98,76,8,0" Name="dataGroupLabelGraph" VerticalAlignment="Top" Background="#64B7B7B7" />
					<TextBlock HorizontalAlignment="Left" Margin="8,79,0,0"  Text="Data Group:" Width="70.893" TextWrapping="WrapWithOverflow" Height="13" VerticalAlignment="Top"/>
					<TextBlock HorizontalAlignment="Left" Margin="8,43,0,0"  Text="Parameters:" VerticalAlignment="Top" Height="29.513"/>
					<TextBox Height="25" Margin="98,40,8,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedGraph.Parameters}" VerticalAlignment="Top" Width="Auto" />

					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabGraphButtonClick"  Margin="0,0,11,10" Grid.Row="2" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom" Grid.Column="1">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Delete This Panel" Height="22" HorizontalAlignment="Left" Margin="8,0,0,13" VerticalAlignment="Bottom" Width="132" Grid.Row="1" />
				</Grid>
			</TabItem>

			<!-- MasterDetail Tab -->
			<TabItem Header="MasterDetail" Name="MasterDetail">
				<Grid Background="#FFE5E5E5">
					<Grid.RowDefinitions>
						<RowDefinition Height="57" />
						<RowDefinition Height="383*" />
						<RowDefinition Height="33" />
						<RowDefinition Height="46" />
					</Grid.RowDefinitions>
						
					<!--Name-->
					<TextBlock HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Height="29.513" />
					<TextBox Height="25" Margin="98,7,8,0"  TextWrapping="Wrap" Text="{Binding Path=SelectedMasterDetail.Name, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top" Width="Auto" />

					<!-- Cascade -->
					<!-- Types -->
					<ListBox Grid.Row="1" Name="TypeOfPanelMasterDetail"  Margin="8,50,8,7" FontSize="15">
						<ListBoxItem Content="Grid" />
						<ListBoxItem Content="Form"/>
						<ListBoxItem Content="Filter"/>
					</ListBox>

					<!--Buttons-->
					<Button Content="New Master" Grid.Row="2" VerticalAlignment="Top" Click="NewMasterClick" Height="22" HorizontalAlignment="Left" Width="137" Margin="8,0,0,0">
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=TypeOfPanelMasterDetail, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
					<Button  Content="New Detail" Grid.Row="2" VerticalAlignment="Top" Click="NewDetailClick" Height="22" HorizontalAlignment="Left" Width="137" Margin="151,0,0,0">
						<Button.Style>
							<Style>
								<Style.Triggers>
									<DataTrigger Binding ="{Binding ElementName=TypeOfPanelMasterDetail, Path=SelectedIndex}" Value="-1">
										<Setter Property="Button.IsEnabled" Value="false"/>
									</DataTrigger>
								</Style.Triggers>
							</Style>
						</Button.Style>
					</Button>
					<Button  Content="Delete Master Detail"  Grid.Row="3" Click="DeleteMasterDetailClick" Margin="8,0,0,10" Width="132" Height="23" VerticalAlignment="Bottom" HorizontalAlignment="Left" />
					<TextBlock Height="16" HorizontalAlignment="Left" Margin="8,17,0,0" Text="Define master and details:" VerticalAlignment="Top" Grid.Row="1" />
					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabMasterDetailsButtonClick"  Margin="0,0,11,10" Grid.Row="3" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom">
						<Image Source="Images\question.png" />
					</Button>
				</Grid>
			</TabItem>

			<!--Entity Tab-->
			<TabItem Name="Entity"  Header="Entity" >
				<Grid Background="#FFE5E5E5" Width="Auto">
					<Grid.RowDefinitions>
						<RowDefinition Height="107" MinHeight="107" />
						<RowDefinition Height="365*" />
						<RowDefinition Height="46" MinHeight="46" MaxHeight="46" />
					</Grid.RowDefinitions>

					<TextBlock Height="29.513" HorizontalAlignment="Left" Margin="8,10,0,0"  Text="Name:" VerticalAlignment="Top" Width="75" />
					<TextBox Name="entityNameBox" Height="25" Margin="98,7,8,0"  Text="{Binding Path=SelectedEntity.Name, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" VerticalAlignment="Top" Width="Auto" >
						
					</TextBox>
						<Button  Content="New Entity"  Click="NewEntityClick" Height="23" Margin="98,52,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="155" />
					<!--IsMantained-->
					<CheckBox IsChecked="{Binding Path=SelectedEntity.IsMaintained}" Content="IsMaintained" Height="16" HorizontalAlignment="Left" Margin="98,83,0,0" VerticalAlignment="Top" IsEnabled="True" />
					<!--
						<CheckBox.IsChecked>
							<MultiBinding Converter="{StaticResource ConvertidorIsMantained}" UpdateSourceTrigger="PropertyChanged"  >
								<Binding Path="App"/>
								<Binding  Path="SelectedEntity"/>
							</MultiBinding>
						</CheckBox.IsChecked>
					</CheckBox>-->

					<!-- IFpug data-->
					<Grid Margin="27,21,0,29" Background="#64B7B7B7" Grid.Row="1" HorizontalAlignment="Left" Width="253">
						<!-- IFPUG points -->
						<!-- Dets -->
						<Label Content="Dets" Height="28" HorizontalAlignment="Left" Margin="23,53,0,0"  VerticalAlignment="Top" />
						<TextBox Text="{Binding Path=SelectedEntity.Dets}" HorizontalAlignment="Left" Margin="83,53,0,0" Width="99" IsEnabled="{Binding Path=SelectedEntity.OverwrittenMeasures}" Height="24" VerticalAlignment="Top" />
						<!-- Ftrs -->
						<Label Content="Rets" Height="28" HorizontalAlignment="Left" Margin="23,80,0,0"  VerticalAlignment="Top" />
						<TextBox Text="{Binding Path=SelectedEntity.Rets}" Height="21" Margin="83,83,0,0"  VerticalAlignment="Top" Width="99" IsEnabled="{Binding Path=SelectedEntity.OverwrittenMeasures}" HorizontalAlignment="Left" />
						<CheckBox Content="Overwrite" Height="16" HorizontalAlignment="Left" Margin="83,121,0,0"  VerticalAlignment="Top" IsChecked="{Binding Path=SelectedEntity.OverwrittenMeasures}" />
					</Grid>

					<Grid  Height="Auto" Margin="301,21,16,29" Background="#64B7B7B7" Grid.Row="1">
					<!-- References -->
					<!-- Dets -->
					<!-- Ftrs -->
						<DataGrid CanUserDeleteRows="False" CanUserAddRows="False" ItemsSource="{Binding Path=SelectedEntity.PanelDet, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" Height="122" Margin="18,30,15,0" Name="panels" VerticalAlignment="Top" SelectionChanged="panels_SelectionChanged"  ClipToBounds="True">
							<DataGrid.Columns>
								<DataGridTextColumn Binding="{Binding Path=Name}" Header="Panel Name" />
								<DataGridTextColumn Binding="{Binding Path=Controls.Count}" Header="Controls Quantity" />
								<DataGridTextColumn Binding="{Binding Path=UpdatesDeletesCascade.Count}" Header="Referenced Entities" />
							</DataGrid.Columns>
						</DataGrid>
						<DataGrid CanUserDeleteRows="False" CanUserAddRows="False" ItemsSource="{Binding Path=SelectedEntity.MasterDetailRet, UpdateSourceTrigger=PropertyChanged}" AutoGenerateColumns="False" Height="122" Margin="18,179,15,0" Name="masterDetails" VerticalAlignment="Top" SelectionChanged="masterDetails_SelectionChanged"  ClipToBounds="True" >
							<DataGrid.Columns>
								<DataGridTextColumn Binding="{Binding Path=Name}" Header="Master Detail Name" />
								<DataGridTextColumn Binding="{Binding Path=Master.Name}" Header="Master Panel Name" />
								<DataGridTextColumn Binding="{Binding Path=Details.Count}" Header="Details Quantity" />
							</DataGrid.Columns>
						</DataGrid>
						<Label Content="Panels (DETs)" Height="28" HorizontalAlignment="Left" Margin="18,6,0,0" VerticalAlignment="Top" />
						<Label Content="Master Details (RETs)" Height="28" HorizontalAlignment="Left" Margin="18,158,0,0" VerticalAlignment="Top" />
					</Grid>

				<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabEntityButtonClick" Margin="0,0,11,10" Grid.Row="2" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom" Grid.Column="1">
						<Image Source="Images\question.png" />
					</Button>
					<Button Content="Delete Entity" Click="DeleteEntityClick" Height="23" Margin="27,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="155" Grid.Row="2" />
				</Grid>
			</TabItem>
			   
			<!--Debugging Tab-->
			<TabItem Name="Debugging"  Header="Summary" IsEnabled="True">
				<Grid Background="#FFE5E5E5">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="368*"/>
						<ColumnDefinition Width="366*" />
					</Grid.ColumnDefinitions>
					
					<Grid.RowDefinitions>

						<RowDefinition Height="439*" />
						<RowDefinition Height="33" />
						<RowDefinition Height="0*" />
						<RowDefinition Height="46" />
					</Grid.RowDefinitions>
					
					<!-- IFPUG model-->
					<Label Content="IFPUG model" Height="28" HorizontalAlignment="Left" Margin="37,19,0,0" VerticalAlignment="Top" />
					<TextBox Margin="18,44,22,0" Name="IfpugModel" Text="{Binding Path=IfpugRepresentation}" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" AllowDrop="False" FontSize="10" IsReadOnly="True" AcceptsTab="False" AcceptsReturn="False" IsEnabled="True" />   
					<!-- COSMIC model-->
					<Label Grid.Column="1" Content="COSMIC model" Height="28" HorizontalAlignment="Left" Margin="37,19,0,0"  VerticalAlignment="Top" />
					<TextBox Grid.Column="1" Margin="18,44,16,0" Name="CosmicModel" Text="{Binding Path=CosmicRepresentation}" FontSize="10" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" IsEnabled="True" IsReadOnly="True" IsManipulationEnabled="True" />
					<Label Content="Exports as HTML" Height="29" HorizontalAlignment="Left" Margin="18,0,0,0"  VerticalAlignment="Bottom" PreviewMouseLeftButtonDown="ExportHtmlIfpugResult" FontStyle="Oblique" FontWeight="Thin" FontStretch="Condensed" ForceCursor="False" Foreground="#FF0075FF" Grid.Row="1" />
					<Button Height="30" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" Click="QuestionTabDebuggingButtonClick"  Margin="0,0,11,10" Grid.Row="3" HorizontalAlignment="Right" Width="33" VerticalAlignment="Bottom" Grid.Column="1">
						<Image Source="Images\question.png" />
					</Button>
					<Label Content="Export Summary" Height="29" HorizontalAlignment="Left" Margin="18,0,0,0"  VerticalAlignment="Bottom" PreviewMouseLeftButtonDown="ExportCosmicSummary"  FontStyle="Oblique" FontWeight="Thin" FontStretch="Condensed" ForceCursor="False" Foreground="#FF0075FF" Grid.Row="1" Grid.Column="1" />
				</Grid>
			</TabItem>
		</TabControl>        
		
		<Grid HorizontalAlignment="Left" Margin="6,12,0,8" Name="grid1" VerticalAlignment="Stretch" Width="206">
			<Grid.RowDefinitions>
				<RowDefinition Height="122" MinHeight="122" />
				<RowDefinition Height="221*" MinHeight="80"/>
				<RowDefinition Height="170*" MinHeight="80"/>
			</Grid.RowDefinitions>            

			<!--Buttons-->
			<TextBlock HorizontalAlignment="Left" Margin="11,59,0,0"  Text="Cosmic size:" VerticalAlignment="Top" Width="113" MouseLeftButtonDown="UpdateCosmicClick"  FontWeight="Thin" FontStretch="Condensed" ForceCursor="False" Foreground="#FF000069" FontSize="12" TextAlignment="Left" />
			<TextBlock HorizontalAlignment="Right" Margin="0,78,9,24" Width="103" Text="{Binding Path=App.IfpugSize}" />
			<TextBlock HorizontalAlignment="Left" Height="20" Margin="12,78,0,0" Text="Ifpug size:" VerticalAlignment="Top" Width="103" MouseLeftButtonDown="UpdateIfpugClick"  FontWeight="Thin" FontStretch="Condensed" ForceCursor="False" Foreground="#FF000069" FontSize="12" />
			<TextBlock HorizontalAlignment="Left" Height="20" Margin="94,59,0,0" VerticalAlignment="Top" Width="103" Text="{Binding Path=App.CosmicSize}"/>
			<Button  Content="Measure" HorizontalAlignment="Left" Margin="12,9,0,0" VerticalAlignment="Top" Width="152" Click="UpdateClick" Height="22"  MouseLeftButtonDown="UpdateCosmicClick"/>

			<!--Time-->
			<Button Name="PlayPauseButton" Margin="171,6,9,0"   VerticalAlignment="Top" Click="PlayStartClick" Height="25" Foreground="{x:Null}" BorderBrush="{x:Null}" Background="{x:Null}" DataContext="{Binding}">
				<Image Width="16">
					<Image.Style>
						<Style TargetType="{x:Type Image}">
							<Style.Triggers>
						 
								<DataTrigger Binding="{Binding  Path=Playing}" Value="False">
									<Setter Property="Source" Value="Images\play.jpg"/>
								</DataTrigger>
								<DataTrigger Binding="{Binding Path=Playing}" Value="True">
									<Setter Property="Source" Value="Images\pause.jpg"/>
								</DataTrigger>
							</Style.Triggers>
						</Style>
					</Image.Style>
				</Image>                
			</Button>
			<TextBlock x:Name="content" HorizontalAlignment="Left" Margin="12,100,0,0" Text="Elapsed time:" VerticalAlignment="Top"/>
			<TextBlock Height="22" Margin="94,100,0,0"  Name="Hour" Text="{Binding Path=Hour}" VerticalAlignment="Top" HorizontalAlignment="Left" Width="20" />
			<TextBlock Height="22" Margin="115,100,0,0"  Name="Minutes" Text="{Binding Path=Minutes}" VerticalAlignment="Top" HorizontalAlignment="Left" Width="17" />
			<TextBlock Height="22" HorizontalAlignment="Left" Margin="138,100,0,0"  Name="Seconds" VerticalAlignment="Top" Width="16" Text="{Binding Path=Seconds, UpdateSourceTrigger=PropertyChanged, NotifyOnTargetUpdated=True, NotifyOnSourceUpdated=True}" />
			<Path Data="M773,246" Fill="#FFF4F4F5" HorizontalAlignment="Right" Height="1" Margin="0,0,-134,233" Stretch="Fill" Stroke="Black" VerticalAlignment="Bottom" Width="1"/>
			<ComboBox HorizontalAlignment="Left" Height="3" Margin="-100,6,0,0"  VerticalAlignment="Top" Width="1"/>

			<!--App tree-->
			<TextBlock HorizontalAlignment="Left" Margin="8,8,0,0"  Text="Model definition:" VerticalAlignment="Top" Width="113" Grid.Row="1" />
			<TreeView Grid.Row="1" Name="AppTreeView" HorizontalAlignment="Left" Margin="6,26,0,1"  Width="194" SelectedItemChanged="AppTreeViewSelectedItemChanged"  FontSize="9" GotFocus="TreeViewGotFocus" IsEnabled="True" DataContext="{Binding Mode=OneTime}">
				<TreeViewItem Name="FirstTreeViewItem" ItemsSource="{Binding Path=App.UseCases}" ItemTemplate="{StaticResource UseCaseTemplate}" Header="{Binding Path=App.Name}" IsExpanded="True"
                              IsManipulationEnabled="False" OverridesDefaultStyle="False"  />
                <TreeView.Resources>
                    <Style TargetType="TreeViewItem">
                        <Setter Property="IsSelected" Value="{Binding Path=IsSelected, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
                        <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
                    </Style>
                </TreeView.Resources>
			</TreeView>

			<!--Entities-->
			<TextBlock HorizontalAlignment="Left" Margin="8,4,0,0"  Text="Entities:" VerticalAlignment="Top" Width="113" Grid.Row="2" />
			<ListBox Grid.Row="2" Name="EntitiesBox" HorizontalAlignment="Left" Margin="8,22,0,38"  Width="192"
			ItemsSource="{Binding Path=App.Entities}" ItemTemplate="{DynamicResource entityLayout}" SelectionChanged="EntitiesBoxSelectionChanged" FontSize="10">
				<ListBox.ContextMenu>
					<ContextMenu>
						<MenuItem Header="Add Entity" Click="NewEntityClick"/>
					</ContextMenu>
				</ListBox.ContextMenu>
			</ListBox>

			<!-- Import Export -->
			<Button  Grid.Row="2" Content="Import" HorizontalAlignment="Left" Margin="8,0,0,8"  VerticalAlignment="Bottom" Width="93" Click="ImportClick"/>
			<Button  Grid.Row="2" Content="Export" Margin="109,0,0,8"  VerticalAlignment="Bottom" Click="ExportClick" HorizontalAlignment="Left" Width="91" />
			<!--Debuggign mode-->
			<CheckBox  Content="Debugging Mode" Height="16" HorizontalAlignment="Left" Margin="13,36,0,0" VerticalAlignment="Top" IsChecked="{Binding Path=TabHeaderVisible}" />
			<Grid.Background>
				<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
					<GradientStop Color="#FFF2EFEF" Offset="0" />
					<GradientStop Color="#FFCBCBCB" Offset="1" />
				</LinearGradientBrush>
			</Grid.Background>
		</Grid>
	</Grid>
</Window>
